m.med = 1
m.dat = date()

Select * from Movmento ;
 where   data = m.dat  ;
   and medico = m.med  ;
 order by hora   ;
  into cursor cHoje

index on Hora tag hora

Dimension vHoras(1)
vHoras(1) = ''

m.Indice  = 1
m.Horaini = medicos.Inicio

do while m.HoraIni <= medicos.termino
   
   if not seek( m.HoraIni )
   
      Dimension vHoras( m.indice )
   
      vHoras( m.Indice ) = m.HoraIni
      
      m.Indice = m.Indice + 1
   endif
   
   m.HoraIni = left(SomHora( m.HoraIni+':00', medicos.Intervalo+':00'),5)
   
enddo

